package ExcelTemp;

import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class CompareCol {
    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream(new File("E:\\引绰济辽\\3.信息化\\5.信息化各标统筹文件\\信息化安全评价和保密措施情况梳理\\信息安全技术网络安全等级保护测评要求-目录-L3-信息化1标.xlsx"));
            Workbook workbook = new XSSFWorkbook(fis);
            Sheet sheet = workbook.getSheetAt(0);
            int count = 0;

            for (Row row : sheet) {
                Cell cellF = row.getCell(5); // F列是第6列，索引从0开始
                Cell cellG = row.getCell(6); // G列是第7列，索引从0开始

                if (cellF != null && cellG != null) {
                    String cellFValue = cellF.getStringCellValue();
                    String cellGValue = cellG.getStringCellValue();

                    if ("满足".equals(cellFValue) && "一标".equals(cellGValue)) {
                        count++;
                    }
                }
            }

            System.out.println("满足条件的行数: " + count);

            workbook.close();
            fis.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}